/**
 * @param {number[]} candidates
 * @return {number}
 */
 var largestCombination = function(candidates) {
  const n = candidates.length
  candidates.sort((a,b) => a-b)
  const max = candidates[n-1]
  let ans = 0, x = 1
  while(x <= max) {
    let cnt = 0
    for(let i = 0; i<n; i++) {
      if(candidates[i] & x) cnt++
    }
    ans = Math.max(ans, cnt)
    x <<= 1
  }
  return ans
};